<?php
/**
 * Created by PhpStorm.
 * User: Lenovo
 * Date: 2018/7/23
 * Time: 10:30
 */

namespace App\Exports;

use App\Models\Users;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;    //设置标题

class UserExport implements FromCollection,WithHeadings
{
    /*
     * Excel类的构造函数
     * 参数mid ：要导出的参会报名者的所属会议活动的id
     */
    public function __construct($params,$type)
    {
        $this->params = $params;
        $this->type = $type;
    }

    //导出数据逻辑
    public function collection()
    {
        return Users::exports($this->params,$this->type);
    }

    //首行标题
    public function headings(): array
    {
        return [
            '昵称',
            '真实姓名',
            '手机号',
            '头像',
            '等级',
            '完成任务数',
            '余额',
            '发布任务数量',
            '状态',
            '账号类型',
            '注册时间'
        ];
    }
}